import { request } from '@/http'
import { services } from '@/config'

export function fetchList(query) {
  return request({
    url: `${services.adminService}sysuserinfo/page`,
    method: 'get',
    params: query
  })
}

export function addObj(obj) {
  return request({
    url: `${services.adminService}sysuserinfo`,
    method: 'post',
    data: obj
  })
}

export function getObj(id) {
  return request({
    url: `${services.adminService}sysuserinfo/${id}`,
    method: 'get'
  })
}

export function delObj(id) {
  return request({
    url: `${services.adminService}sysuserinfo/${id}`,
    method: 'delete'
  })
}

export function putObj(obj) {
  return request({
    url: `${services.adminService}sysuserinfo`,
    method: 'put',
    data: obj
  })
}

export function detailsNumber(number) {
  return request({
    url: `${services.adminService}sysuserinfo/details/number/${number}`,
    method: 'get'
  })
}

export function countIdNumber(idNumber) {
  return request({
    url: `${services.adminService}sysuserinfo/count/${idNumber}`,
    method: 'get'
  })
}

export function getId() {
  return request({
    url: `${services.adminService}sysuserinfo/getId`,
    method: 'get'
  })
}

export function syncData() {
  return request({
    url: `${services.adminService}sysuserinfo/syncData`,
    method: 'get'
  })
}

/**
 * 修改为退休人员
 * @param id
 * @returns {*}
 */
export function retireUser(id) {
  return request({
    url: `${services.adminService}sysuserinfo/retireUser/${id}`,
    method: 'get'
  })
}

/**
 *
 * @param {用户ID} userId
 * @returns 用户基本信息
 */
export function getByUserId(userId) {
  return request({
    url: `${services.adminService}sysuserinfo/getByUserId/${userId}`,
    method: 'get'
  })
}
